﻿namespace 原型模式
{
   public class GameSystem
   {
        private WaterActor _waterActor;
        private FlyActor _flyActor;
        private RoadActor _roadActor;

       public GameSystem(WaterActor waterActor, FlyActor flyActor, RoadActor roadActor)
       {
           _waterActor = waterActor;
           _flyActor = flyActor;
           _roadActor = roadActor;
       }
        //重点 使用Clone创建多个对象
       public void RunGame()
       {
            //创建4个水下敌人
            var w1 = _waterActor.Clone();
            var w2 = _waterActor.Clone();
            var w3 = _waterActor.Clone();
            var w4 = _waterActor.Clone();

            //攻击不管是否穿盔甲
            w1.KnifeAttack();
            w2.KnifeAttack();
            w3.KnifeAttack();
            w4.KnifeAttack();

            //创建2个空中敌人
           var f1 = _flyActor.Clone();
           var f2 = _flyActor.Clone();

            f1.BombAtteck();
            f2.BombAtteck();

            //创建3个陆地的敌人
            var r1 = _roadActor.Clone();
            var r2 = _roadActor.Clone();
            var r3 = _roadActor.Clone();

            r1.GunAtteck();
            r2.GunAtteck();
            r3.GunAtteck();
        }
    }
}
